package com.qn.common.util;

import jakarta.servlet.http.HttpServletResponse;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseCookie;
/**
 * qingniu-cloud user source analysis
 *
 * @Author: TXG
 * @Date: 2024/6/11
 * @Version V0.0.2
 */
public class SetCookieUtil {
    
    public static void setVid(HttpServletResponse response, String domain, String vid)
    {
        ResponseCookie cookie= ResponseCookie.from("vid", vid)
                .httpOnly(true)
                .secure(true)
                .domain(domain)
                .path("/")
                .maxAge(60*60*24*90)
                .sameSite("None")
                .build();
        response.setHeader(HttpHeaders.SET_COOKIE, cookie.toString());
    }
}
